package pl.cvplus.entity;

import javax.persistence.Basic;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.ManyToOne;

/**
 * Created by IntelliJ IDEA.
 * User: Piotrek
 * Date: 02.03.12
 * Time: 23:16
 * To change this template use File | Settings | File Templates.
 */
@javax.persistence.Table(name = "cp_dictionary_value", schema = "public", catalog = "")
@Entity
public class CpDictionaryValue {
    private Integer id;

    @javax.persistence.Column(name = "id", nullable = false, insertable = true, updatable = true, length = 10, precision = 0)
    @Id
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    private String dictValue;

    @javax.persistence.Column(name = "dict_value", nullable = false, insertable = true, updatable = true, length = 30, precision = 0)
    @Basic
    public String getDictValue() {
        return dictValue;
    }

    public void setDictValue(String dictValue) {
        this.dictValue = dictValue;
    }

    private Integer languageFk;

    @javax.persistence.Column(name = "language_fk", nullable = true, insertable = true, updatable = true, length = 10, precision = 0)
    @Basic
    public Integer getLanguageFk() {
        return languageFk;
    }

    public void setLanguageFk(Integer languageFk) {
        this.languageFk = languageFk;
    }

    private Integer dictionaryFk;

    @javax.persistence.Column(name = "dictionary_fk", nullable = true, insertable = true, updatable = true, length = 10, precision = 0)
    @Basic
    public Integer getDictionaryFk() {
        return dictionaryFk;
    }

    public void setDictionaryFk(Integer dictionaryFk) {
        this.dictionaryFk = dictionaryFk;
    }

    private Integer listOrder;

    @javax.persistence.Column(name = "list_order", nullable = true, insertable = true, updatable = true, length = 10, precision = 0)
    @Basic
    public Integer getListOrder() {
        return listOrder;
    }

    public void setListOrder(Integer listOrder) {
        this.listOrder = listOrder;
    }

    private String positionOption;

    @javax.persistence.Column(name = "position_option", nullable = true, insertable = true, updatable = true, length = 1, precision = 0)
    @Basic
    public String getPositionOption() {
        return positionOption;
    }

    public void setPositionOption(String positionOption) {
        this.positionOption = positionOption;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        CpDictionaryValue that = (CpDictionaryValue) o;

        if (dictValue != null ? !dictValue.equals(that.dictValue) : that.dictValue != null) return false;
        if (dictionaryFk != null ? !dictionaryFk.equals(that.dictionaryFk) : that.dictionaryFk != null) return false;
        if (id != null ? !id.equals(that.id) : that.id != null) return false;
        if (languageFk != null ? !languageFk.equals(that.languageFk) : that.languageFk != null) return false;
        if (listOrder != null ? !listOrder.equals(that.listOrder) : that.listOrder != null) return false;
        if (positionOption != null ? !positionOption.equals(that.positionOption) : that.positionOption != null)
            return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id != null ? id.hashCode() : 0;
        result = 31 * result + (dictValue != null ? dictValue.hashCode() : 0);
        result = 31 * result + (languageFk != null ? languageFk.hashCode() : 0);
        result = 31 * result + (dictionaryFk != null ? dictionaryFk.hashCode() : 0);
        result = 31 * result + (listOrder != null ? listOrder.hashCode() : 0);
        result = 31 * result + (positionOption != null ? positionOption.hashCode() : 0);
        return result;
    }

    private CpDictionary cpDictionaryByDictionaryFk;

    @ManyToOne
    public
    @javax.persistence.JoinColumn(name = "dictionary_fk", referencedColumnName = "id")
    CpDictionary getCpDictionaryByDictionaryFk() {
        return cpDictionaryByDictionaryFk;
    }

    public void setCpDictionaryByDictionaryFk(CpDictionary cpDictionaryByDictionaryFk) {
        this.cpDictionaryByDictionaryFk = cpDictionaryByDictionaryFk;
    }

    private CpLanguage cpLanguageByLanguageFk;

    @ManyToOne
    public
    @javax.persistence.JoinColumn(name = "language_fk", referencedColumnName = "id")
    CpLanguage getCpLanguageByLanguageFk() {
        return cpLanguageByLanguageFk;
    }

    public void setCpLanguageByLanguageFk(CpLanguage cpLanguageByLanguageFk) {
        this.cpLanguageByLanguageFk = cpLanguageByLanguageFk;
    }
}
